<?php
  // Avatars STAte
  require_once dirname(__FILE__)."/../purin2/alter/alter.php";

  // drop or clear
  puSql("drop table asta");
  puDelete("delete from asta");

  // create table
  puSql("create table asta (
    i_asta integer auto_increment not null, -- serial
    j_user integer not null,                -- avatar's owner
    j_tmap integer not null,                -- map where avatar is
    i_x integer not null,                   -- location on map where avatar is
    i_y integer not null,                   -- location on map where avatar is
    d_update datetime not null,             -- time of last update (players that didn't moved for e.g. 2 hours will be deleted from asta)
    v_action varchar(20) character set utf8 collate utf8_general_ci not null,          -- walk, sit, stand, attack, die, ...
    v_animation varchar(20) character set utf8 collate utf8_general_ci not null,       -- left, right, up, down, ...
    j_head integer,                         -- head (join to eqty, can be null if do not wearing hat)
    j_hair integer,                         -- hairstyle
    i_red integer,                          -- hairstyle color - red part
    i_green integer,                        -- hairstyle color - green part
    i_blue integer,                         -- hairstyle color - blue part
    j_chest integer,                        -- chest
    j_leg integer,                          -- leg
    j_feet integer,                         -- feet
    j_hands integer,                        -- hands
    v_race varchar(20) character set utf8 collate utf8_general_ci not null,            -- male/female, later may be from lookup tab
    v_chat varchar(255) character set utf8 collate utf8_general_ci not null,           -- last chat message
    i_chat integer,                         -- chat unix timestamp (seconds since 1970)
    primary key (i_asta)
  )");

  // index
  puSql("create unique index p_asta_1 on asta (i_asta)");
  puSql("create unique index s_asta_1 on asta (j_user)"); 
?>